package com.ruix.app.network;

import com.hyphenate.EMCallBack;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMCursorResult;
import com.hyphenate.chat.EMMessage;
import com.hyphenate.exceptions.HyphenateException;
import com.ruix.app.constant.RuiXConstant;
import com.ruix.app.mapper.ApiMapper;
import com.ruix.app.model.Comment;
import com.ruix.app.model.HXChatMessage;
import com.ruix.app.model.Notice;
import com.ruix.app.model.NoticeReleaseModel;
import com.ruix.app.model.UserInfo;
import com.ruix.app.network.exception.HXException;
import com.ruix.app.util.EMMessageUtil;
import com.ruix.app.util.LogUitl;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.Observer;


/**
 * Created by hadexs on 2017/4/12.
 */

public class RequestFactory  extends  BaseRequestFactory{


    //登录
    public static void getAccessToken(String code,ApiMapper mapper,Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addGetParameter("appid", RuiXConstant.WX_APP_ID);
        requestParams.addGetParameter("secret",RuiXConstant.WX_APP_AppSecret);
        requestParams.addGetParameter("code",code);
        requestParams.addGetParameter("grant_type","authorization_code");
        requestParams.setUrl(ApiConstant.API_WX_ACCESS_TOKEN);
        execute(requestParams,mapper,observer);
    }

    //userinfo
    public static void getWXUserinfo(String assesstoken,String openid,ApiMapper mapper,Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addGetParameter("access_token", assesstoken);
        requestParams.addGetParameter("openid",openid);
        requestParams.addGetParameter("lang","zh_CN");
//        requestParams.addGetParameter("appid", RuiXConstant.WX_APP_ID);
//        requestParams.addGetParameter("secret",RuiXConstant.WX_APP_AppSecret);
        requestParams.setUrl(ApiConstant.API_WX_USER_INFO);
        execute(requestParams,mapper,observer);
    }



    //登录
    public static void login(String accessToken,String openid,Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("access_token",accessToken);
        requestParams.addFormParameter("openid",openid);
        requestParams.setUrl(ApiConstant.API_WX_LOGIN);
        execute(requestParams,observer);
    }

    //退出登录
    public static void logout(Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_LOGOUT);
        execute(requestParams,observer);
    }


    //发送验证码
    public static void  sendVerify(String phone,Observer observer) {
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("mobie",phone);
        requestParams.setUrl(ApiConstant.API_SMS_SNED);
        execute(requestParams,observer);

    }

    //绑定手机号
    public static void bindMobile(String phone,String verifyCode,Observer observer) {
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("mobie",phone);
        requestParams.addFormParameter("verify_code",verifyCode);
        requestParams.setUrl(ApiConstant.API_BIND_MOBIE);
        execute(requestParams,observer);
    }

    //编辑用户信息
    public static void editUserinfo(UserInfo userInfo,ApiMapper mapper, Observer observer) {
        RequestParams requestParams = new RequestParams();
        if (userInfo.getName() != null) {
            requestParams.addFormParameter("name", userInfo.getName());
        }
        if (userInfo.getLocate() != null) {
            requestParams.addFormParameter("locate", userInfo.getLocate());
        }
        if (userInfo.getPosition() != null) {
            requestParams.addFormParameter("position", userInfo.getPosition());
        }
        if (userInfo.getEmail() != null) {
            requestParams.addFormParameter("email", userInfo.getEmail());
        }
        if (userInfo.getCompany() != null) {
            requestParams.addFormParameter("company", userInfo.getCompany());
        }

        if (userInfo.getAvatarPath() != null){
            requestParams.addFormParameter("avatar_path", userInfo.getAvatarPath());
        }

        if (userInfo.getBirthday() != null){
            requestParams.addFormParameter("birthday", userInfo.getBirthday());
        }


        if (userInfo.getSex() >= 0) {
            requestParams.addFormParameter("sex", userInfo.getSex());
        }
        requestParams.setUrl(ApiConstant.API_USER_UPDATE);
        execute(requestParams,mapper,observer);
    }

    public static void updateUserInfo(ApiMapper mapper, Observer observer) {
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_USER_UPDATE);
        execute(requestParams,mapper,observer);
    }




    //我的圈子 列表
    public static void classesList(ApiMapper mapper,Observer observer) {
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASSES_INDEX);
        execute(requestParams,mapper,observer);
    }


    //我的圈子 列表
    public static void classSugestList(ApiMapper mapper, Observer observer) {
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASSES_SUGEST_LIST);
        execute(requestParams,mapper,observer);
    }

    //系统信息
    public static void systemInfo(ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_SYSTEM_CONFIG);
        execute(requestParams,mapper,observer);
    }


    //帖子列表
    public static void classPostList(String classid,int limit,int offset, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("limit",limit);
        requestParams.addFormParameter("offset",offset);
        requestParams.setUrl(ApiConstant.API_CLASS_POST_LIST + classid);
        execute(requestParams,mapper,observer);
    }

    //帖子详情
    public static void classPostsDetail(String postid, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_POST_DETAIL + postid);
        execute(requestParams,mapper,observer);
    }

    //删除帖子
    public static void deletePosts(String postid, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_POST_DELET + postid);
        execute(requestParams,mapper,observer);
    }

    //删除评论
    public static void deleteCommnet(String commentId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_POST_DELET_COMMENT + commentId);
        execute(requestParams,mapper,observer);
    }

    //帖子作者信息
    public static void postAuthorInfo(String postid,ApiMapper mapper, Observer observer) {
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("pid", postid);
        requestParams.setUrl(ApiConstant.API_CLASS_POST_AUTHOR_INFO);
        execute(requestParams, mapper, observer);
    }



    //发表评论
    public static void pushCommnet(String postid, Comment commont, ApiMapper mapper, Observer observer) {
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("reply_id", commont.getReplyID() != null ? commont.getReplyID() : "0");
        requestParams.addFormParameter("content", commont.getContent());
        requestParams.setUrl(ApiConstant.API_CLASS_POST_COMMENT + postid);
        execute(requestParams, mapper, observer);
    }

    //点赞
    public static void likePosts(String commentId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_POST_LIKE + commentId);
        execute(requestParams,mapper,observer);
    }

    //发布
    public static void publishPosts(String classid,String content,String album, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("content", content != null ? content :"");
        requestParams.addFormParameter("album", album); //图片
        requestParams.setUrl(ApiConstant.API_CLASS_POST_PUBLISH + classid);
        execute(requestParams,mapper,observer);
    }

    public static void publishPosts(String classid,String content,String album,String lid, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("content", content != null ? content :"");
        requestParams.addFormParameter("album", album); //图片
        requestParams.addFormParameter("lid", lid); //图片
        requestParams.setUrl(ApiConstant.API_CLASS_POST_PUBLISH + classid);
        execute(requestParams,mapper,observer);
    }

    //班级 标签
    public static void postTag(String classID,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_POST_TAGS + classID);
        execute(requestParams,mapper,observer);
    }

    //举报
    public static void reportPost(String postId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("pid", postId);
        requestParams.setUrl(ApiConstant.API_CLASS_POST_REPORT);
        execute(requestParams,mapper,observer);
    }

    //班级详情
    public static void classDetail(String calssId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_DETAIL + calssId);
        execute(requestParams,mapper,observer);
    }

    //通知列表
    public static void noticeList(String classid,int limit,int offset, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("limit", limit);
        requestParams.addFormParameter("offset", offset);
        requestParams.setUrl(ApiConstant.API_CLASS_NOTICE_LIST + classid);
        execute(requestParams,mapper,observer);
    }

    //通知详情
    public static void noticeDetail(String noticeId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_NOTICE_DETAIL + noticeId);
        execute(requestParams,mapper,observer);
    }

    //确认通知
    public static void confirmNotice(String noticeId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_COMFIRM_NOTICE + noticeId);
        execute(requestParams,mapper,observer);
    }

    //未确认人员
    public static void uncomfirmUsers(String noticeId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_UNCONFIRMED + noticeId);
        execute(requestParams,mapper,observer);
    }

    //创建通知
    public static void createNotice(NoticeReleaseModel model, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("type",model.getType());
        requestParams.addFormParameter("title",model.getTitle());
        requestParams.addFormParameter("content",model.getContent());
        if (model.getAlbumPath() != null){
            requestParams.addFormParameter("album_path", model.getAlbumPath());
        }
        if (model.isNeedConfirm()) {
            requestParams.addFormParameter("need_confirm", 1);
        } else {
            requestParams.addFormParameter("need_confirm", 0);
        }
        requestParams.setUrl(ApiConstant.API_CLASS_NOTICE_CREATE + model.getClassID());
        execute(requestParams,mapper,observer);
    }

    //通知留言
    public static void sendNoticeComment(String noticeId,String content, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("content", content); //
        requestParams.setUrl(ApiConstant.API_CLASS_SEND_NOTICE_COMMENT + noticeId);
        execute(requestParams,mapper,observer);
    }

    //删除通知
    public static void deleteNoticeComment(String noticeId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_DELETE_COMMENT + noticeId);
        execute(requestParams,mapper,observer);
    }


    //意见反馈
    public static void feedbackAdvice(String classID,String content, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("cid", classID);
        requestParams.addFormParameter("content", content);
        requestParams.setUrl(ApiConstant.API_SYSTEM_FEEDBACK);
        execute(requestParams,mapper,observer);
    }

    //意见反馈列表
    public static void feedbackList(String classID,int limit,int offset, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("cid", classID);
        requestParams.addFormParameter("limit", limit);
        requestParams.addFormParameter("offset", offset);
        requestParams.setUrl(ApiConstant.API_FEEDBACK_LIST);
        execute(requestParams,mapper,observer);
    }





    //班级成员
    public static void getClassMenbers(String noticeId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_MENBERS + noticeId);
        execute(requestParams,mapper,observer);
    }

    //禁言
    public static void prohibite(String classId,String menberId, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();//menberId
        requestParams.addFormParameter("uid", menberId);
        requestParams.setUrl(ApiConstant.API_CLASS_PROHIBITE + classId);
        execute(requestParams,mapper,observer);
    }


    public static void setShareState(String classId,boolean enable, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();//menberId
        if (enable){
            requestParams.addFormParameter("share", "1");
        } else {
            requestParams.addFormParameter("share", "0");
        }
        requestParams.setUrl(ApiConstant.API_CLASS_SHARE + classId);
        execute(requestParams,mapper,observer);
    }







//    //圈子二维码
//    public static void getClassBarcode(String classID, Observer observer){
//        RequestParams requestParams = new RequestParams();
//        requestParams.setUrl(ApiConstant.API_CLASS_BARCODE + classID);
//        execute(requstForString(requestParams),observer);
//    }




    public static void getOssToken( ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_SYSTEM_OSSTOKEN);
        execute(requestParams,mapper,observer);
    }



    //上传文件到阿里云
    public static void uploadFileToALY(ALUploadFileParam alUploadFileParam , Observer observer){
        Observable observable = albUploadFileObservale(alUploadFileParam);
        execute(observable,observer);
    }

    //上传文件到阿里云
    public static void uploadVoiceFileToALY(ALUploadFileParam alUploadFileParam , Observer observer){
        Observable observable = albUploadVoiceFileObservale(alUploadFileParam);
        execute(observable,observer);
    }


    //消息
    public static void messageList(int limit,int offset, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("limit", limit);
        requestParams.addFormParameter("offset", offset);
        requestParams.setUrl(ApiConstant.API_MESSAGE_LIST);
        execute(requestParams,mapper,observer);
    }

    //设置为已读
    public static void setMessageRead(String mid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("mids", mid);
        requestParams.setUrl(ApiConstant.API_MESSAGE_READ);
        execute(requestParams,mapper,observer);
    }

    //检测APP更新
    public static void checkAppUpgrade(ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addGetParameter("api_token", "b3effd7edf577141ae6100f8872a6c0d");
        requestParams.addGetParameter("type", "android");
//        requestParams.addFormParameter("a","a");
        requestParams.setUrl(ApiConstant.API_FIR_LATEST+"58fc6d72ca87a812f9000108");
        execute(requestParams,mapper,observer);
    }


    //案例学习
    public static void getCourseList(String cid,boolean desc,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_COURSE_LIST + cid);
        if (desc) {
            requestParams.addFormParameter("sort", "1");
        } else {
            requestParams.addFormParameter("sort", "0");
        }

        execute(requestParams,mapper,observer);
    }

    //课程详情
    public static void getCourseLesson(String cid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_COURSE_LESSON + cid);
        execute(requestParams,mapper,observer);
    }

    //禁言 // TODO: 2017/5/18
    public static void getSystemKey(String key,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("key",key);
        requestParams.setUrl(ApiConstant.API_SYSTEM_GET);
        execute(requestParams,mapper,observer);
    }
    

    //解除禁言
    //禁言 // TODO: 2017/5/18
    public static void setSystemKeyValue(String key,String value, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("key",key);
        requestParams.addFormParameter("value",value);
        requestParams.setUrl(ApiConstant.API_SYSTEM_SET);
        execute(requestParams,mapper,observer);
    }


    //课程发送
    public static void getCoursePostMember(String courseid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_POST_MEMBER + courseid);
        execute(requestParams,mapper,observer);
    }

    //上报播放记录
    public static void setCourseLastReport(String courseid,int  time, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("lid",courseid);
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("report",time);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        requestParams.addFormParameter("report",jsonObject.toString());
        requestParams.setUrl(ApiConstant.API_COURSE_REPORT);
        execute(requestParams,mapper,observer);
    }


    //获取聊天记录
    public static void getChatList(String groupid,long startTime,int limit, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("group_id",groupid);
        requestParams.addFormParameter("created_at",startTime);
        requestParams.addFormParameter("limit",limit);
        requestParams.setUrl(ApiConstant.API_COURSE_CHAT_RECORD);
        execute(requestParams,mapper,observer);
    }

    public static void sendHXChat(HXChatMessage chatMessage, ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("group_id",chatMessage.getGroupId());
        requestParams.addFormParameter("from",chatMessage.getFrom());//
        requestParams.addFormParameter("type",chatMessage.getType());
        if (chatMessage.isText()){
            requestParams.addFormParameter("msg",chatMessage.getMessage());
        } else if (chatMessage.isImage()){
            requestParams.addFormParameter("fpath",chatMessage.getFpath());
//            requestParams.addFormParameter("width",chatMessage.getFpath());
//            requestParams.addFormParameter("height",chatMessage.getFpath());
        } else if (chatMessage.isVoice()){
            requestParams.addFormParameter("length",chatMessage.getLength());
            requestParams.addFormParameter("fpath",chatMessage.getFpath());
        }
        requestParams.addFormParameter("ext",chatMessage.getExt());
        requestParams.setUrl(ApiConstant.API_COURSE_CHAT);
        execute(requestParams,mapper,observer);
    }









    private static Observable joinGroupObser(final String groupid){
        return   Observable.create(new ObservableOnSubscribe<Boolean>() {
            @Override
            public void subscribe(final ObservableEmitter<Boolean> emitter) {
                try {
                    EMClient.getInstance().groupManager().joinGroup(groupid);
                    emitter.onNext(true);
                } catch (HyphenateException e) {
                    e.printStackTrace();
                    emitter.onError(e);
                }
                emitter.onComplete();
            }
        });
    }


    public static void joinGroup(String groupid,Observer observer){
        execute(joinGroupObser(groupid),observer);
    }
    


    //发送消息
    private static Observable sendHXGroupMessageObser(final String content, final String toChatUsername){
      return   Observable.create(new ObservableOnSubscribe<Boolean>() {
            @Override
            public void subscribe(final ObservableEmitter<Boolean> emitter) throws Exception {
//                EMMessageUtil.sendGroupMessage(content, toChatUsername);

                //创建一条文本消息，content为消息文字内容，toChatUsername为对方用户或者群聊的id，后文皆是如此
//                EMClient.getInstance().groupManager().joinGroup("16201768042497");

                EMCursorResult<String> result  = EMClient.getInstance().groupManager().fetchGroupMembers("16201768042497","", 20);

                EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
                //如果是群聊，设置chattype，默认是单聊
                //        if (chatType == CHATTYPE_GROUP)
                message.setChatType(EMMessage.ChatType.GroupChat);
                message.setMessageStatusCallback(new EMCallBack() {
                    @Override
                    public void onSuccess() {
                        emitter.onNext(Boolean.TRUE);
                        emitter.onComplete();
                    }

                    @Override
                    public void onError(int i, String s) {
                        Exception exception = new HXException(i,s);
                        emitter.onError(exception);
                    }

                    @Override
                    public void onProgress(int i, String s) {
                        //显示进度


                    }
                });
                //发送消息
                EMClient.getInstance().chatManager().sendMessage(message);
            }
        });
    }

    public static void sendHXGroupMessage( String content, final String toChatUsername,Observer observer){
        execute(sendHXGroupMessageObser(content,toChatUsername),observer);
    }


    //组织圈列表
    public static void organizationList(String cid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_ORGANIZATION + cid);
        execute(requestParams,mapper,observer);
    }

    //退出师友圈
    public static void quitCircle(String cid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_CLASS_QUIT + cid);
        execute(requestParams,mapper,observer);
    }

    //聊天消息点赞
    public static void chatLike(String msgid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_COURSE_CHAT_LIKE + msgid);
        execute(requestParams,mapper,observer);
    }

    //购买圈子
    public static void payClass(String cid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_PAY_CLASS + cid);
        execute(requestParams,mapper,observer);
    }

    //加入的圈子信息
    public static void wxOrderMentor(String enid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("encrypt_id",enid);
        requestParams.setUrl(ApiConstant.API_WX_ORDER_MENTOR);
        execute(requestParams,mapper,observer);
    }

//    API_PAY_CLASS

    //标签相关帖子列表
    public static void postContainTag(String cid,String tag,int limit,int offset,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("tag",tag);
        requestParams.addFormParameter("limit",limit);
        requestParams.addFormParameter("offset",offset);
        requestParams.setUrl(ApiConstant.API_CLASS_POST_TAG+ cid);
        execute(requestParams,mapper,observer);
    }

    //购买明细
    public static void fundDetail(int limit,int offset,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("limit",limit);
        requestParams.addFormParameter("offset",offset);
        requestParams.setUrl(ApiConstant.API_USER_FUND_DETAIL);
        execute(requestParams,mapper,observer);
    }



    //已读
    public static void setMessageReaded(String recordid,ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.addFormParameter("record_id",recordid);
        requestParams.setUrl(ApiConstant.API_COURSE_READ);
        execute(requestParams,mapper,observer);
    }

    //已读
    public static void getMessageUnreaded(ApiMapper mapper, Observer observer){
        RequestParams requestParams = new RequestParams();
        requestParams.setUrl(ApiConstant.API_MESSAGE_UNREAD);
        execute(requestParams,mapper,observer);
    }


    ///user/fund-detail

    //

}
